//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "math\fn_getRanAirPointCircle.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_center", "_radius", "_center_x", "_center_y", "_ret_val", "_co", "_angle", "_x1", "_y1", "_helper","_slope_dist"];
DEFAULT_PARAM(_center,0,[]);
DEFAULT_PARAM(_radius,1,100);
DEFAULT_PARAM(_min_dist,2,0);
if (_radius < _min_dist) then { _min_dist = 0; };
// TODO: Add a check to see if it's still inside the map!
_center_x = _center select 0;_center_y = _center select 1;

for [{_i = 0},{_i < 50},{_i=_i+1}] do {
	_angle = floor (random 360);
	_randradius = _min_dist + random(_radius - _min_dist);
	_x1 = _center_x - (_randradius * sin _angle);
	_y1 = _center_y - (_randradius * cos _angle);
	_ret_val = [_x1, _y1, 0];
	if (_x1 > 0 && _y1 > 0 && _x1 < GVAR(ISLAND_SIZE) && _y1 < GVAR(ISLAND_SIZE)) exitWith {};
};

TRACE_1("End",_ret_val);
TMFPROFILERSTOP;
_ret_val
